package com.xyoto.community.adminController;

import com.xyoto.community.dto.AddSquareModuleDTO;
import com.xyoto.community.dto.UpdateSquareModuleDTO;
import com.xyoto.community.service.SquareModuleConfigService;
import com.xyoto.community.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * @author coderFu
 * @create 2021/11/15
 */
@RestController
@Api(tags = "广场配置模块")
@RequestMapping("/squareConfig")
public class SquareModuleConfigController {

    @Autowired
    private SquareModuleConfigService squareModuleConfigService;

    @ApiOperation("新增广场模块信息")
    @PostMapping("/addSquareModule")
    public Result addSquareModule(@Validated AddSquareModuleDTO addSquareModuleDTO){
        return squareModuleConfigService.addSquareModule(addSquareModuleDTO);
    }

    @ApiOperation("修改广场模块信息")
    @PutMapping("/updateSquareModule")
    public Result updateSquareModule(@Validated UpdateSquareModuleDTO updateSquareModuleDTO){
        return squareModuleConfigService.updateSquareModule(updateSquareModuleDTO);
    }

    @ApiOperation("获取广场模块展示列表")
    @GetMapping("/getSquareModuleList")
    public Result getSquareModuleList(){
        return squareModuleConfigService.getSquareModuleList();
    }

    @ApiOperation("根据广场模块id查询模块信息")
    @GetMapping("/getSquareModuleById")
    public Result getSquareModuleById(@RequestParam("id") Integer id){
        return squareModuleConfigService.getSquareModuleById(id);
    }



}
